/**
* @Author: zmx
* @Date: 2023/9/26
* @Description:
*/
<template>
  <el-dialog :title="'巡检任务报告'" :visible.sync="show" append-to-body width="80%" :before-close="handleClose">
    <div class="videoContent">
      <div class="left">
        <el-row>
          <el-col :span="8">
            <div>
              <span>巡检名称:</span>
              <span>{{info.taskName}}</span>
            </div>
          </el-col>
          <el-col :span="8">
            <div>
              <span>充电站名称：</span>
              <span>{{info.stationName}}</span>
            </div>
          </el-col>
          <el-col :span="8">
            <div>
              <span>巡检方案：</span>
              <span>{{info.patrolPlanName}}</span>
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <div>
              <span>巡检类型：</span>
              <span>{{info.patrolPlanType}}</span>
            </div>
          </el-col>
          <el-col :span="8">
            <div>
              <span>巡检开始日期：</span>
              <span>{{info.startTime}}</span>
            </div>
          </el-col>
          <el-col :span="8">
            <div>
              <span>巡检结束日期：</span>
              <span>{{info.endTime}}</span>
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div>
              <span>巡检作业项：</span>
              <span style="display: inline-block;margin-right: 10px" v-for="item in normalList">{{item}}</span>
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <div>
              <span>巡检结论：</span>
              <span>{{info.reportDesc}}</span>
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <div>
              <span>正常作业项：</span>
            </div>
          </el-col>
          <el-col :span="12">
            <div>
              <span>异常作业项：</span>
            </div>
          </el-col>
        </el-row>
      </div>
      <div style="display: flex;justify-content: space-between">
        <div class="center">
          <el-table :data="info.normalList" :header-cell-style="{background:'#D6D6D6',color:'#404040'}"  style="width: 100%">
            <el-table-column label="序号" width="50">
              <template v-slot="scope">
                {{ scope.$index + 1 }}
              </template>
            </el-table-column>
            <el-table-column prop="assignSubName" label="作业项"></el-table-column>
            <el-table-column prop="checkDesc" label="结论"></el-table-column>
            <el-table-column label="操作">
              <template v-slot="scope">
                <el-button class="common-btn" @click="getDetail(scope.row)">查看截图</el-button>
                <el-image
                  ref="imageRef"
                  v-show="false"
                  style="width: 100px; height: 100px"
                  :src="scope.row.checkUrl"
                  :zoom-rate="1.2"
                  :preview-src-list="[scope.row.checkUrl]"
                  :initial-index="1"
                  fit="cover"
                />
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div class="center">
          <el-table :data="info.warnList" :header-cell-style="{background:'#D6D6D6',color:'#404040'}"  style="width: 100%">
            <el-table-column label="序号" width="50">
              <template v-slot="scope">
                {{ scope.$index + 1 }}
              </template>
            </el-table-column>
            <el-table-column prop="assignSubName" label="作业项"></el-table-column>
            <el-table-column prop="warnLevel" label="告警等级">
              <template v-slot="scope">
               <span :style="{color:warnLevel[Number(scope.row.warnLevel)-1].color}">
                  {{warnLevel[Number(scope.row.warnLevel)-1].name}}
               </span>
              </template>
            </el-table-column>
            <el-table-column prop="checkDesc" label="结论">
              <template v-slot="scope">
                <el-tooltip placement="top">
                  <span slot="content">{{ scope.row.checkDesc }}</span>
                  <span class="tooltipClass">{{ scope.row.checkDesc }}</span>
                </el-tooltip>
              </template>
            </el-table-column>
            <el-table-column label="操作">
              <template v-slot="scope">
                <el-button class="common-btn" @click="getDetail(scope.row)">查看截图</el-button>
                <el-image
                  ref="imageRef"
                  v-show="false"
                  style="width: 100px; height: 100px"
                  :src="scope.row.checkUrl"
                  :zoom-rate="1.2"
                  :preview-src-list="[scope.row.checkUrl]"
                  :initial-index="1"
                  fit="cover"
                />
              </template>
            </el-table-column>
          </el-table>

        </div>

      </div>
    </div>
  </el-dialog>
</template>

<script>
import {patrol} from '../../api/inspection/apiUntil'
import {getPatrolConfirm} from "../../api/inspection/pator";

export default {
  props: ['DialogVideo','row'],
  data() {
    return {
      show:false,
      tableData:[],
      info:'',
      tableDataList:[],
      normalList:[],
      warnLevel:[
        {
          name:'暂无风险',
          color:'green'
        },
        {
          name:'低风险',
          color:'green'
        },
        {
          name:'中风险',
          color:'#FF8D1A'
        },
        {
          name:'高风险',
          color:'#FF0000'
        },
        {
          name:'重大风险',
          color:'red'
        },
      ],
    };
  },
  mounted() {
    //显示弹窗
    this.show = this.DialogVideo
    this.getInit()
    // this.getPatrolCameraList()
  },
  methods: {
    getDetail(){
      this.$refs.imageRef.showViewer = true
    },
    getInit(){
      patrol.getPatrolConfirm({taskId:this.row.taskId,taskCurrentId:this.row.id}).then((res)=>{
        if(res.data){
          // this.tableData = res.data.assignmentVO
          this.info = res.data
          this.info.normalList.map((item)=>{
            this.normalList.push(item.assignSubName)
          })
          this.info.warnList.map((item)=>{
            this.normalList.push(item.assignSubName)
          })
        }
      })
    },
    // //获取摄像头列表
    // getPatrolCameraList(){
    //   patrol.getPatrolCameraList({stationId:this.row.stationId}).then((res)=>{
    //     if(res){
    //       console.log(res.data )
    //       this.tableDataList = res.data
    //     }
    //   })
    // },
    handleClose(){
      this.show = false
      this.$emit('closeDialog')
    }
  }
};
</script>

<style lang="scss" scoped>
> > > .el-dialog__header {
  padding: 20px !important;
  background: #1B7B87;
}

> > > .el-dialog__title {
  color: #fff !important;
  font-size: 16px;
}
>>> .el-dialog__body{
  padding-top: 0;
}
>>> .el-table{
  margin-top: 0;
}
.videoContent{
  .left{
    div{
      margin-top: 15px;
      span{
        display: inline-block;

      }
    }
  }
  .center{
    margin-top: 15px;
    border-radius: 4px;
    border: 1px solid #c2c1c1;
    margin-right: 20px;
    width: 48%;
  }
}
</style>
